#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
struct plane{
	int l,r;
}f[100010],ff[100010];
bool cmp(plane a,plane b){
	return a.l<b.l;
}
int main(){
	freopen("airport.in","r",stdin);
	freopen("airport.out","w",stdout);
	int n,m,mm,ans=0;
	scanf("%d %d %d",&n,&m,&mm);
	for(int i=1;i<=m;i++){
		scanf("%d %d",&f[i].l,&f[i].r);
	}
	for(int i=1;i<=mm;i++){
		scanf("%d %d",&ff[i].l,&ff[i].r);
	}
	sort(f+1,f+1+m,cmp);
	sort(ff+1,ff+1+mm,cmp);
	for(int i=0;i<=n;i++){
		int l1=i,l2=n-i,cnt=0;
		int u1=1,u2=1;
		int a[100010],t=1,tt=2;
		memset(a,0,sizeof(a));
		if(l1){
			a[t++] = f[1].r;
			cnt++;
			for(int p=2;p<=m;p++){
				int x = f[p].l;
				int o=t;
				for(int k=1;k<o;k++){
					if(x<a[k]&&u1<l1){
						u1++;
						a[t++] = f[p].r;
						cnt++;
//						printf("%d x \n",x);
						break;
					}
					else if(x>a[k]){
						a[k] = f[p].r;
						cnt++;
//						printf("%d xx \n",x);
						break;
					}
				}
			}
		}
		memset(a,0,sizeof(a));
		t = 1,tt=2;
		if(l2){
			a[t++] = ff[1].r;
			cnt++;
			for(int p=2;p<=mm;p++){
				int x = ff[p].l;
				int o=t;
				for(int k=1;k<o;k++){
					if(x<a[k]&&u2<l2){
						u2++;
						a[t++] = ff[p].r;
						cnt++;
//						printf("%d y \n",x);
						break;
					}
					else if(x>a[k]){
						a[k] = ff[p].r;
						cnt++;
//						printf("%d yy \n",x);
						break;
					}
				}
			}
		}
//		printf("%d\n",cnt);
		ans = max(ans,cnt);
	}
	printf("%d",ans);
	fclose(stdin);
	fclose(stdout);
	return 0;
}
